Skip to content

fix(llm, openai): Stop a redeemed usage reset locking the account out - #1171

Open
JeanMertz wants to merge 2 commits into
pr5-auth-flagfrom
pr6-retry-on-reset
Open

fix(llm, openai): Stop a redeemed usage reset locking the account out#1171
JeanMertz wants to merge 2 commits into
pr5-auth-flagfrom
pr6-retry-on-reset

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

A turn that spends a reset credit now keeps trying for up to a minute
while the redemption reaches the responses host, instead of retrying
once and abandoning the turn. The account confirms a redemption before
the host honours it, so that single immediate retry almost always
landed in the gap: the credit was spent, the reset applied, and the
turn ended anyway with Rate limited.

Attempts go out every five seconds until the request is admitted. The
credit is spent by then and the turn is unfinished, so waiting is what
the user paid for; each attempt is an admission-stage rejection that
bills nothing. Exactly one credit is spent however long the wait runs.

The wait is bounded because the other explanation for the refusal — a
usage window the credit does not cover — looks identical from here and
never resolves. When the budget runs out the turn falls through to the
rest of the chain as before.

Redeeming a usage reset no longer leaves the subscription profile
unusable for a week. A turn that spends a reset credit and is still
refused now records the short 30-minute cooldown instead of the reset
timing the rejection reports, so the next `jp query` asks the provider
again rather than refusing locally with `no usable credential`.

The rejection that follows a redemption describes a usage state JP
itself just changed, and the window its headers name need not be the one
the credit reopened. Reading that timing as gospel recorded a cooldown
at the seven-day cap against an account the user could still reach
through Codex, and only a re-login cleared it.

A reset credit also reopens a single window, so one is no longer spent
when the limit reports more than one window already spent: the request
stays refused either way, and the plan holds few credits.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
A turn that spends a reset credit now keeps trying for up to a minute
while the redemption reaches the responses host, instead of retrying
once and abandoning the turn. The account confirms a redemption before
the host honours it, so that single immediate retry almost always
landed in the gap: the credit was spent, the reset applied, and the
turn ended anyway with `Rate limited`.

Attempts go out every five seconds until the request is admitted. The
credit is spent by then and the turn is unfinished, so waiting is what
the user paid for; each attempt is an admission-stage rejection that
bills nothing. Exactly one credit is spent however long the wait runs.

The wait is bounded because the other explanation for the refusal — a
usage window the credit does not cover — looks identical from here and
never resolves. When the budget runs out the turn falls through to the
rest of the chain as before.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant